package net.dodoman.enumexam;

public enum Color {
	RED {
		int getCode() {
			return 0;
		}
	},
	GREEN {
		int getCode() {
			return 1;
		}

	},
	BLUE {
		int getCode() {
			return 2;
		}

	},
	YELLOW {
		int getCode() {
			return 3;
		}

	};
	public static void main(String args[]) {
		Color red = Color.RED, green = Color.GREEN;
		System.out.println(red);
		System.out.println(green);
		paint(red);
		paint(green);
	}

	// private int code;
	//
	// Color(int code) {
	// this.code = code;
	// }

	private static void paint(Color color) {
		switch (color) {
		case RED:
			System.out.println("paint red now--"
			// + " color.code=" + color.code
					+ "RED.getCode()=" + RED.getCode());
			break;
		case GREEN:
			System.out.println("paint green now--"
			// + " color.code="+ color.code
					+ "GREEN.getCode()=" + GREEN.getCode());
		default:
			break;
		}
	}

	abstract int getCode();
}
